import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '产业名称',
    align: 'center',
    dataIndex: 'goodsType_dictText'
  },
  {
    title: '专业名称',
    align: 'left',
    dataIndex: 'typeName'
  },
  {
    title: '所属部门',
    align: 'center',
    dataIndex: 'sysOrgCode'
  },
  {
    title: '排序',
    align: 'center',
    sorter: true,
    dataIndex: 'sorts'
  },
  {
    title: '父级节点',
    align: 'center',
    ifShow: false,
    dataIndex: 'pid'
  },
  {
    title: '是否上架',
    align: 'center',
    dataIndex: 'isValidate_dictText',
    customRender: ({ text, record }) => {
      // 如果 _dictText 字段有值，直接显示
      if (text) {
        return text;
      }
      // 如果没有，则使用原始值进行字典转换
      return render.renderDict(record.isValidate, 'yes_no');
    },
  },
 
  {
    title: '价格',
    align: 'center',
    dataIndex: 'price'
  },
  {
    title: '单位',
    align: 'center',
    dataIndex: 'unit'
  },
  {
    title: '分类图片',
    align: 'center',
    dataIndex: 'pic',
    customRender: render.renderImage,
  },
  {
    title: '商品详情',
    align: 'center',
    dataIndex: 'details',
  },
  {
    title: '关联药店',
    align: 'center',
    dataIndex: 'shop'
  },
  {
    title: '库存',
    align: 'center',
    dataIndex: 'num'
  },
  {
    title: '商品编号',
    align: 'center',
    dataIndex: 'productCode'
  },
  {
    title: '商品条形码',
    align: 'center',
    dataIndex: 'arcode'
  },
  {
    title: '商品追溯码',
    align: 'center',
    dataIndex: 'traceCode'
  },
  {
    title: '商品二维码',
    align: 'center',
    dataIndex: 'ecode'
  },
  {
    title: '型号',
    align: 'center',
    dataIndex: 'model'
  },
  {
    title: '商品规格',
    align: 'center',
    dataIndex: 'productPecs'
  },
  {
    title: '规格',
    align: 'center',
    dataIndex: 'specification'
  },
  {
    title: '材质',
    align: 'center',
    dataIndex: 'material'
  },
  {
    title: '含量',
    align: 'center',
    dataIndex: 'packagingUnit'
  },
  {
    title: '外观包装',
    align: 'center',
    dataIndex: 'externalPack'
  },
  {
    title: '销售单价',
    align: 'center',
    dataIndex: 'sellingPrice'
  },
  {
    title: '销售折扣率',
    align: 'center',
    dataIndex: 'salesRate'
  },
  {
    title: '销售折扣后单价',
    align: 'center',
    dataIndex: 'discountPrice'
  },
  {
    title: '销售小计金额',
    align: 'center',
    dataIndex: 'subtotalAmount'
  },
  {
    title: '生产日期',
    align: 'center',
    dataIndex: 'productionDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '使用期限',
    align: 'center',
    dataIndex: 'serviceLife',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '失效日期',
    align: 'center',
    dataIndex: 'expiryDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '近效期示警标签',
    align: 'center',
    dataIndex: 'warningLabel'
  },
  {
    title: '专利等知识产权说明',
    align: 'center',
    dataIndex: 'propertyNotes'
  },
  {
    title: '产品说明书',
    align: 'center',
    dataIndex: 'productManual'
  },
  {
    title: '产品注册许可证编号',
    align: 'center',
    dataIndex: 'licenseNumber'
  },
  {
    title: '生产批号 ',
    align: 'center',
    dataIndex: 'serialNumber'
  },
  {
    title: '质量层次',
    align: 'center',
    dataIndex: 'qualityLevel'
  },
  {
    title: '生产厂家',
    align: 'center',
    dataIndex: 'manufacturer'
  },
  {
    title: '产地',
    align: 'center',
    dataIndex: 'originPlace_dictText'
  },
  {
    title: '厂家生产许可证编号',
    align: 'center',
    dataIndex: 'productionLicense'
  },
  {
    title: '采购人资质要求',
    align: 'center',
    dataIndex: 'purchaseRequirements_dictText'
  },
  {
    title: '贮存要求',
    align: 'center',
    dataIndex: 'storageRequirements'
  },
  {
    title: '堆放要求',
    align: 'center',
    dataIndex: 'stackingRequirements'
  },
  {
    title: '搬运要求',
    align: 'center',
    dataIndex: 'handlingRequirements'
  },
  {
    title: '销售前库存数量',
    align: 'center',
    dataIndex: 'salesStorage'
  },
  {
    title: '销售数量',
    align: 'center',
    dataIndex: 'salesQuantity'
  },
  {
    title: '当前库存数量',
    align: 'center',
    dataIndex: 'currentStorage'
  },
  {
    title: '紧急程度',
    align: 'center',
    dataIndex: 'urgencyLevel'
  },
  {
    title: '非工作时段',
    align: 'center',
    dataIndex: 'nonworkingHours'
  },
  {
    title: '节假日',
    align: 'center',
    dataIndex: 'holidays'
  },
  {
    title: ' 是否当面签收',
    align: 'center',
    dataIndex: 'issign'
  },
  {
    title: '是否审核',
    align: 'center',
    dataIndex: 'isAuth_dictText'
  },
  {
    title: '是否要求安装',
    align: 'center',
    dataIndex: 'isinstall'
  },
  {
    title: '安装具体要求',
    align: 'center',
    dataIndex: 'installRequirement'
  },
  {
    title: '是否要求配件',
    align: 'center',
    dataIndex: 'isAccessories'
  },
  {
    title: '配件具体要求',
    align: 'center',
    dataIndex: 'acceRequirement'
  },
  {
    title: '备注',
    align: 'center',
    dataIndex: 'remarks'
  },
  {
    title: '商品上架申请单位',
    align: 'center',
    dataIndex: 'applicationUnit'
  },
  {
    title: '商品上架申请单位对接人',
    align: 'center',
    dataIndex: 'contactPerson'
  },
  {
    title: '规格编码',
    align: 'center',
    dataIndex: 'standardCode'
  },
  {
    title: '是否直营',
    align: 'center',
    dataIndex: 'isDirect'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "所属部门",
    field: "sysOrgCode",
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "是否上架",
    field: "isValidate",
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yes_no"
    },
    //colProps: {span: 6},
  },
  {
    label: "产业名称",
    field: "goodsType",
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "shop_type"
    },
    //colProps: {span: 6},
  },
  {
    label: "专业名称",
    field: "typeName",
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "商品编号",
    field: "productCode",
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "是否审核",
    field: "isAuth",
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '排序',
    field: 'sorts',
    component: 'InputNumber',
  },
  {
    label: '父级节点',
    field: 'pid',
    component: 'JTreeSelect',
    componentProps: {
      dict: "medication_shop,type_name,id",
      pidField: "pid",
      pidValue: "0",
      hasChildField: "has_child",
    },
  },
  {
    label: '是否上架',
    field: 'isValidate',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode: "yes_no"
     },
  },
  {
    label: '产业名称',
    field: 'goodsType',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode: "shop_type"
     },
  },
  {
    label: '专业名称',
    field: 'typeName',
    component: 'Input',
  },
  {
    label: '价格',
    field: 'price',
    component: 'InputNumber',
  },
  {
    label: '单位',
    field: 'unit',
    component: 'Input',
  },
  {
    label: '分类图片',
    field: 'pic',
     component: 'JImageUpload',
     componentProps:{
        fileMax: 6
      },
  },
  {
    label: '商品详情',
    field: 'details',
    component: 'JEditor',
  },
  {
    label: '关联药店',
    field: 'shop',
    component: 'Input',
  },
  {
    label: '库存',
    field: 'num',
    component: 'InputNumber',
  },
  {
    label: '商品编号',
    field: 'productCode',
    component: 'Input',
  },
  {
    label: '商品条形码',
    field: 'arcode',
    component: 'Input',
  },
  {
    label: '商品追溯码',
    field: 'traceCode',
    component: 'Input',
  },
  {
    label: '商品二维码',
    field: 'ecode',
    component: 'Input',
  },
  {
    label: '型号',
    field: 'model',
    component: 'Input',
  },
  {
    label: '商品规格',
    field: 'productPecs',
    component: 'Input',
  },
  {
    label: '规格',
    field: 'specification',
    component: 'Input',
  },
  {
    label: '材质',
    field: 'material',
    component: 'Input',
  },
  {
    label: '含量',
    field: 'packagingUnit',
    component: 'Input',
  },
  {
    label: '外观包装',
    field: 'externalPack',
    component: 'Input',
  },
  {
    label: '销售单价',
    field: 'sellingPrice',
    component: 'InputNumber',
  },
  {
    label: '销售折扣率',
    field: 'salesRate',
    component: 'InputNumber',
  },
  {
    label: '销售折扣后单价',
    field: 'discountPrice',
    component: 'InputNumber',
  },
  {
    label: '销售小计金额',
    field: 'subtotalAmount',
    component: 'Input',
  },
  {
    label: '生产日期',
    field: 'productionDate',
    component: 'DatePicker',
  },
  {
    label: '使用期限',
    field: 'serviceLife',
    component: 'DatePicker',
  },
  {
    label: '失效日期',
    field: 'expiryDate',
    component: 'DatePicker',
  },
  {
    label: '近效期示警标签',
    field: 'warningLabel',
    component: 'Input',
  },
  {
    label: '专利等知识产权说明',
    field: 'propertyNotes',
    component: 'Input',
  },
  {
    label: '产品说明书',
    field: 'productManual',
    component: 'Input',
  },
  {
    label: '产品注册许可证编号',
    field: 'licenseNumber',
    component: 'Input',
  },
  {
    label: '生产批号 ',
    field: 'serialNumber',
    component: 'Input',
  },
  {
    label: '质量层次',
    field: 'qualityLevel',
    component: 'Input',
  },
  {
    label: '生产厂家',
    field: 'manufacturer',
    component: 'Input',
  },
  {
    label: '产地',
    field: 'originPlace',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode: "citizen"
     },
  },
  {
    label: '厂家生产许可证编号',
    field: 'productionLicense',
    component: 'Input',
  },
  {
    label: '采购人资质要求',
    field: 'purchaseRequirements',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode: "buy_auth"
     },
  },
  {
    label: '贮存要求',
    field: 'storageRequirements',
    component: 'Input',
  },
  {
    label: '堆放要求',
    field: 'stackingRequirements',
    component: 'Input',
  },
  {
    label: '搬运要求',
    field: 'handlingRequirements',
    component: 'Input',
  },
  {
    label: '销售前库存数量',
    field: 'salesStorage',
    component: 'InputNumber',
  },
  {
    label: '销售数量',
    field: 'salesQuantity',
    component: 'Input',
  },
  {
    label: '当前库存数量',
    field: 'currentStorage',
    component: 'Input',
  },
  {
    label: '紧急程度',
    field: 'urgencyLevel',
    component: 'Input',
  },
  {
    label: '非工作时段',
    field: 'nonworkingHours',
    component: 'Input',
  },
  {
    label: '节假日',
    field: 'holidays',
    component: 'Input',
  },
  {
    label: ' 是否当面签收',
    field: 'issign',
    component: 'Input',
  },
  {
    label: '是否审核',
    field: 'isAuth',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode: "yn"
     },
  },
  {
    label: '是否要求安装',
    field: 'isinstall',
    component: 'Input',
  },
  {
    label: '安装具体要求',
    field: 'installRequirement',
    component: 'Input',
  },
  {
    label: '是否要求配件',
    field: 'isAccessories',
    component: 'Input',
  },
  {
    label: '配件具体要求',
    field: 'acceRequirement',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remarks',
    component: 'Input',
  },
  {
    label: '商品上架申请单位',
    field: 'applicationUnit',
    component: 'Input',
  },
  {
    label: '商品上架申请单位对接人',
    field: 'contactPerson',
    component: 'Input',
  },
  {
    label: '规格编码',
    field: 'standardCode',
    component: 'Input',
  },
  {
    label: '是否直营',
    field: 'isDirect',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  sysOrgCode: {title: '所属部门',order: 0,view: 'text', type: 'string',},
  sorts: {title: '排序',order: 1,view: 'number', type: 'number',},
  pid: {title: '父级节点',order: 2,view: 'text', type: 'string',},
  isValidate: {title: '是否上架',order: 3,view: 'list', type: 'string',dictCode: 'yes_no',},
  goodsType: {title: '产业名称',order: 4,view: 'list', type: 'string',dictCode: 'shop_type',},
  typeName: {title: '专业名称',order: 5,view: 'text', type: 'string',},
  price: {title: '价格',order: 6,view: 'number', type: 'number',},
  unit: {title: '单位',order: 7,view: 'text', type: 'string',},
  pic: {title: '分类图片',order: 8,view: 'image', type: 'string',},
  details: {title: '商品详情',order: 9,view: 'umeditor', type: 'string',},
  shop: {title: '关联药店',order: 10,view: 'text', type: 'string',},
  num: {title: '库存',order: 11,view: 'number', type: 'number',},
  productCode: {title: '商品编号',order: 12,view: 'text', type: 'string',},
  arcode: {title: '商品条形码',order: 13,view: 'text', type: 'string',},
  traceCode: {title: '商品追溯码',order: 14,view: 'text', type: 'string',},
  ecode: {title: '商品二维码',order: 15,view: 'text', type: 'string',},
  model: {title: '型号',order: 16,view: 'text', type: 'string',},
  productPecs: {title: '商品规格',order: 17,view: 'text', type: 'string',},
  specification: {title: '规格',order: 18,view: 'text', type: 'string',},
  material: {title: '材质',order: 19,view: 'text', type: 'string',},
  packagingUnit: {title: '含量',order: 20,view: 'text', type: 'string',},
  externalPack: {title: '外观包装',order: 21,view: 'text', type: 'string',},
  sellingPrice: {title: '销售单价',order: 22,view: 'number', type: 'number',},
  salesRate: {title: '销售折扣率',order: 23,view: 'number', type: 'number',},
  discountPrice: {title: '销售折扣后单价',order: 24,view: 'number', type: 'number',},
  subtotalAmount: {title: '销售小计金额',order: 25,view: 'text', type: 'string',},
  productionDate: {title: '生产日期',order: 26,view: 'date', type: 'string',},
  serviceLife: {title: '使用期限',order: 27,view: 'date', type: 'string',},
  expiryDate: {title: '失效日期',order: 28,view: 'date', type: 'string',},
  warningLabel: {title: '近效期示警标签',order: 29,view: 'text', type: 'string',},
  propertyNotes: {title: '专利等知识产权说明',order: 30,view: 'text', type: 'string',},
  productManual: {title: '产品说明书',order: 31,view: 'text', type: 'string',},
  licenseNumber: {title: '产品注册许可证编号',order: 32,view: 'text', type: 'string',},
  serialNumber: {title: '生产批号 ',order: 33,view: 'text', type: 'string',},
  qualityLevel: {title: '质量层次',order: 34,view: 'text', type: 'string',},
  manufacturer: {title: '生产厂家',order: 35,view: 'text', type: 'string',},
  originPlace: {title: '产地',order: 36,view: 'list', type: 'string',dictCode: 'citizen',},
  productionLicense: {title: '厂家生产许可证编号',order: 37,view: 'text', type: 'string',},
  purchaseRequirements: {title: '采购人资质要求',order: 38,view: 'list', type: 'string',dictCode: 'buy_auth',},
  storageRequirements: {title: '贮存要求',order: 39,view: 'text', type: 'string',},
  stackingRequirements: {title: '堆放要求',order: 40,view: 'text', type: 'string',},
  handlingRequirements: {title: '搬运要求',order: 41,view: 'text', type: 'string',},
  salesStorage: {title: '销售前库存数量',order: 42,view: 'number', type: 'number',},
  salesQuantity: {title: '销售数量',order: 43,view: 'text', type: 'string',},
  currentStorage: {title: '当前库存数量',order: 44,view: 'text', type: 'string',},
  urgencyLevel: {title: '紧急程度',order: 45,view: 'text', type: 'string',},
  nonworkingHours: {title: '非工作时段',order: 46,view: 'text', type: 'string',},
  holidays: {title: '节假日',order: 47,view: 'text', type: 'string',},
  issign: {title: ' 是否当面签收',order: 48,view: 'text', type: 'string',},
  isAuth: {title: '是否审核',order: 49,view: 'list', type: 'string',dictCode: 'yn',},
  isinstall: {title: '是否要求安装',order: 50,view: 'text', type: 'string',},
  installRequirement: {title: '安装具体要求',order: 51,view: 'text', type: 'string',},
  isAccessories: {title: '是否要求配件',order: 52,view: 'text', type: 'string',},
  acceRequirement: {title: '配件具体要求',order: 53,view: 'text', type: 'string',},
  remarks: {title: '备注',order: 54,view: 'text', type: 'string',},
  applicationUnit: {title: '商品上架申请单位',order: 55,view: 'text', type: 'string',},
  contactPerson: {title: '商品上架申请单位对接人',order: 56,view: 'text', type: 'string',},
  standardCode: {title: '规格编码',order: 57,view: 'text', type: 'string',},
  isDirect: {title: '是否直营',order: 58,view: 'text', type: 'string',},
};
